package myTeam.timeShop.bean;

// Generated 2016-3-28 15:20:15 by Hibernate Tools 3.2.2.GA

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
@NamedQueries({
	@NamedQuery(name="getAllMyNoSeeChar" ,query="from TbChar c where c.tbUserByCharTo.userId = ? and c.charIsSaw = 0 "),
	@NamedQuery(name="updateAllMyNoSeeChar",query="update TbChar c set c.charIsSaw = 1 where  c.tbUserByCharTo.userId = ? and c.charIsSaw = 0")
})
/**
 * Entity: 
 */
@Entity
@Table(name = "tb_char", catalog = "db_timeshop")
public class TbChar implements java.io.Serializable {

	/** 
	 * �����¼id.
	 */

	private Integer charId;

	/** 
	 * �յ������û�id.
	 */

	private TbUser tbUserByCharTo;

	/** 
	 * ���������û�id.
	 */

	private TbUser tbUserByCharFrom;

	/** 
	 * ������Ϣ.
	 */

	private String charMessage;

	/** 
	 * ����ʱ��.
	 */

	private Date charTime;

	/** 
	 * �����Ƿ񱻲���.
	 */

	private Integer charIsSaw;

	public TbChar() {
	}

	public TbChar(TbUser tbUserByCharTo, TbUser tbUserByCharFrom,
			String charMessage, Date charTime, Integer charIsSaw) {
		setTbUserByCharTo(tbUserByCharTo);
		setTbUserByCharFrom(tbUserByCharFrom);
		setCharMessage(charMessage);
		setCharTime(charTime);
		setCharIsSaw(charIsSaw);
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "char_id", unique = true, nullable = false)
	public Integer getCharId() {
		return this.charId;
	}

	public void setCharId(Integer charId) {
		this.charId = charId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "char_to")
	public TbUser getTbUserByCharTo() {
		return this.tbUserByCharTo;
	}

	public void setTbUserByCharTo(TbUser tbUserByCharTo) {
		this.tbUserByCharTo = tbUserByCharTo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "char_from")
	public TbUser getTbUserByCharFrom() {
		return this.tbUserByCharFrom;
	}

	public void setTbUserByCharFrom(TbUser tbUserByCharFrom) {
		this.tbUserByCharFrom = tbUserByCharFrom;
	}

	@Column(name = "char_message", length = 1000)
	public String getCharMessage() {
		return this.charMessage;
	}

	public void setCharMessage(String charMessage) {
		this.charMessage = charMessage;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "char_time", length = 19)
	public Date getCharTime() {
		return this.charTime;
	}

	public void setCharTime(Date charTime) {
		this.charTime = charTime;
	}

	@Column(name = "char_is_saw")
	public Integer getCharIsSaw() {
		return this.charIsSaw;
	}

	public void setCharIsSaw(Integer charIsSaw) {
		this.charIsSaw = charIsSaw;
	}

}
